<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>hello chatGPT</title>
    <script src="https://s3.pstatp.com/cdn/expire-1-M/jquery/3.3.1/jquery.min.js"></script>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>
</head>

<body >
<div class="row text-center" style="padding-left: 350px;">
    <div class="col-lg-6 ">
        <div class="input-group" style="    padding-top: 10px;
    padding-bottom: 20px;">

            <input id="inputQue" type="text" class="form-control" placeholder="请输入问题">
            <span class="input-group-btn">
        <button class="btn btn-default" th:onclick="'javascript:submitQue();'" type="button">确认</button>
      </span>
        </div><!-- /input-group -->
        <textarea class="form-control " rows="3"></textarea>
    </div><!-- /.col-lg-6 -->
</div><!-- /.row -->

</body>
<script>
  function submitQue() {
    que = $("#inputQue").val();
    $.ajax({
      type: "GET",
      url: "/api?que=" + que,
      contentType: "application/json; charset=utf-8",
      success: function (data) {
        $("textarea").val(data);
      },
      error: function () {
        alert("系统超时！");
      }
    });
  }
</script>
</html>
